<!-- 车位申请进度 -->
<template>
	<view>
		<view>
			<view class="bg-white" v-if="roomDetail.housebindstate !== 0">
				<view class="cu-steps">
					<view class="cu-item" :class="index>active?'':'text-green'" v-for="(item,index) in steps"
						:key="index">
						<text :class="'cuIcon-' + item.cuIcon"></text> {{item.name}}
					</view>
				</view>
			</view>

			<view class="cu-form-group">
				<view class="title">业主</view>
				<input v-model="owner" style="text-align:right"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">车牌号</view>
				<input v-model="carNum" style="text-align:right"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">品牌</view>
				<input v-model="carBrand" style="text-align:right"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">颜色</view>
				<input v-model="carColor" style="text-align:right"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">车辆类型</view>
				<view class="title" :value="carTypeName">{{carTypeName}}</view>
			</view>
			<view class="cu-form-group">
				<view class="title">起租日期</view>
				<view class="title" :value="carTypeName">{{startDate}}</view>
			</view>
			<view class="cu-form-group">
				<view class="title">结组日期</view>
				<view class="title" :value="carTypeName">{{endDate}}</view>
			</view>
			<view class="cu-form-group align-start">
				<view class="title">备注信息</view>
				<textarea maxlength="-1" v-model="remark" placeholder="请输入备注信息"></textarea>
			</view>

			<view class="bottomRegion">
				<button @click="myParkingSpace" type="primary">我的车位信息</button>
				<button @click="houseUnbundling" type="warn">取消车位审核</button>
			</view>

			<view class="cu-modal" :class="delOwnerMemberFlag==true?'show':''">
				<view class="cu-dialog">
					<view class="cu-bar bg-white justify-end">
						<view class="content">温馨提示</view>
						<view class="action" @tap="_cancleCall()">
							<text class="cuIcon-close text-red"></text>
						</view>
					</view>
					<view class="padding-xl">
						您确认解除该成员车位审核？
					</view>
					<view class="cu-bar bg-white justify-end">
						<view class="action margin-0 flex-sub  solid-left" @tap="_cancleDeleteOwnerMember()">取消</view>
						<view class="action margin-0 flex-sub text-green solid-left" @tap="_doDeleteOwnerMember()">确认
						</view>
					</view>
				</view>
			</view>
		</view>


	</view>
</template>

<script>
	// pages/my/myHouseDetail.js
	import context from '../../lib/java110/Java110Context.js';
	const factory = context.factory;

	export default {
		data() {
			return {
				carTypeName: "客车",
				startDate: "2022-10-01",
				endDate: "2022-10-02",
				delOwnerMemberFlag: false, //解除房屋绑定弹窗
				steps: [{
					cuIcon: 'usefullfill',
					name: '申请',
					desc: ''
				}, {
					cuIcon: 'radioboxfill',
					name: '审核中',
					desc: ''
				}, {
					cuIcon: 'roundcheckfill',
					name: '完成',
					desc: ''
				}],
				active: 1,
				ownerInfo: {},
				// 用户信息
				userInfo: {},
				// 用户信息
				ownerFlag: false,
				// 是否有业主信息 标记 如果有为 true  没有为false
				roomDetail: {},
				listId:{},
			};
		},

		components: {},
		props: {},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			let _that = this;
			context.onLoad(options);
			_that.roomDetail = JSON.parse(options.room);
			
			console.log("数据", _that.roomDetail)
		},

		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady: function() {},

		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function() {},

		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide: function() {},

		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload: function() {},

		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh: function() {},

		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function() {},

		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {},
		methods: {
			loadOwenrInfo: function() {
				let _that = this;

				context.getOwner(function(_ownerInfo) {
					console.log(_ownerInfo);

					if (_ownerInfo) {
						_that.ownerFlag = true;
						_that.ownerInfo = _ownerInfo;
					} else {
						_that.ownerFlag = false;
					}
				});
			},
			// 我的车位
			myParkingSpace(){
				uni.navigateTo({
					url:"./myParking"
					// url:"./myParking?car="+JSON.stringify(item)
				})
			},
			// 解除房屋绑定
			houseUnbundling: function(item) {
				this.delOwnerMemberFlag = true;
				this.curOwnerMember = item;
			},
			_cancleDeleteOwnerMember: function(item) {
				this.delOwnerMemberFlag = false;
			},
			_doDeleteOwnerMember: function() {
				let that = this;
				this.curOwnerMember.communityId = this.communityId;
				deleteOwnerMember(this.curOwnerMember)
					.then((res) => {
						uni.showToast({
							icon: 'none',
							title: '删除成功'
						});
						that._cancleDeleteOwnerMember();
						that._initData();
					}, (err) => {
						uni.showToast({
							icon: 'none',
							title: err
						});
						that._cancleDeleteOwnerMember();
					})
			}
		}
	};
</script>
<style scoped lang="scss">
	@import "@/pagesB/my/myHouseDetail.css";

	text {
		text-align: center;
	}

	.block__title {
		margin: 0;
		font-weight: 400;
		font-size: 14px;
		color: rgba(69, 90, 100, .6);
		padding: 40rpx 30rpx 20rpx;
	}

	.bottomRegion {
		width: 100%;
		height: 100rpx;
		position: fixed;
		bottom: 20rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;
		button {
			font-size: 26rpx;
			width: 300rpx;
			height: 70rpx;
			text-align: center;
			margin-top: 15rpx;
			line-height: 70rpx;
			font-size: 26rpx;
			border-radius: 40rpx 40rpx;
		}
	}
</style>
